package demo2;

public class Test3 {
    public static void main(String[] args) throws InterruptedException {
        Thread t3 = new Thread(()->{
            for (int i = 0; i < 5; i++) {
                System.out.println("线程执行中");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        t3.start();
        System.out.println("join 开始等待");
        t3.join();
        System.out.println("join 等待结束");
        for (int i = 0; i < 5; i++) {
            System.out.println("main主线程");
            Thread.sleep(1000);
        }
    }
}
